#include <riscv/csr.h>
#include <asm/linkage.h>

ENTRY(arch_local_irq_disable)
    csrc CSR_STATUS, SR_IE
    ret

ENTRY(arch_local_irq_enable)
    csrs CSR_STATUS, SR_IE
    ret

ENTRY(arch_local_irq_save)
    csrrc a0, CSR_STATUS, SR_IE
    ret

ENTRY(arch_local_irq_restore)
    and a0, a0, SR_IE
    csrs CSR_STATUS, a0
    ret

ENTRY(arch_irqs_disabled)
    csrr a0, CSR_STATUS
    and a0, a0, SR_IE
    ret
